<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Helper\Build\Build as Builds;
use App\Models\Site;
class BuildCover extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'build:cover';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '定时生成首页以及封面页';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
		$Builds = new Builds();
		$arr = $Builds->index();
		echo $arr['msg'].chr(10);
		//获取封面页
		$list = Site::get();
		foreach($list as $row)
		{
			$arr = $Builds->cover($row);
			echo $row->domain.':'.$arr['msg'].chr(10);
		}
    }
}
